package com.openlab.callsystem.controller;

import com.openlab.callsystem.entity.Manage;
import com.openlab.callsystem.service.ManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
public class ManageController {
    @Autowired
    ManageService manageService;
    @PostMapping("/manage/login")
    public String login(HttpServletRequest request){
        HttpSession session = request.getSession();
        String account=request.getParameter("account");
        String password=request.getParameter("password");
        Manage manager = manageService.login(account, password);
        if (manager!=null){
            return "redirect:/mainindex";

        }else{
            return "redirect:/login";
        }
    }
}
